package com.dyw.springbootpersonal.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * @author Devil
 * @create 2022-01-29-19:25
 */
@SuppressWarnings("all")
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(autoResultMap = true)
public class User {
   @TableId(
           value = "user_id", type = IdType.AUTO
   )
   private Integer userId;
   private String userName;
   private String password;
   private String gender;
   private String nickname;
   private String birthday;
   @TableLogic
   @TableField(fill = FieldFill.INSERT)
   private Integer level;
   @TableField(fill = FieldFill.INSERT)
   private Integer isVip;
   @TableField(fill = FieldFill.INSERT)
   private String registerTime;

   public User(Integer userId, String userName, String password, String gender, String nickname, String birthday, Integer level, Integer isVip) {
      this.userId = userId;
      this.userName = userName;
      this.password = password;
      this.gender = gender;
      this.nickname = nickname;
      this.birthday = birthday;
      this.level = level;
      this.isVip = isVip;
   }

   public User(String userName, String password, String gender, String nickname, String birthday) {
      this.userName = userName;
      this.password = password;
      this.gender = gender;
      this.nickname = nickname;
      this.birthday = birthday;
      this.level = 0;
      this.isVip = 0;
      this.registerTime = new Timestamp(System.currentTimeMillis()).toString();
   }
}
